#include "Precompiled.h"
#include "SceneLogic.h"

#include "../Common/Scene.h"
#include "../Common/EntityLogicPair.h"

namespace Game {
namespace Logic {

SceneLogic::SceneLogic() {
}

SceneLogic::~SceneLogic() {
}

const RTTI& SceneLogic::GetEntityRTTI() const {
    return Scene::rtti;
}

void SceneLogic::Update(Entity* gameEntity, const float& elapsedTime) {
    Scene* scene = static_cast<Scene*>(gameEntity);
    CollectionIterator<EntityLogicPair*> it(scene->GetEntityLogic());
    for (; it(); ++it) {
        EntityLogicPair* pair = *it;
        if (pair->GetGameEntity()->GetEnabled()) {
            pair->Update(elapsedTime);
        }
    }
}

}
}